/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.etecmatao.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "estagio")
@NamedQueries({
    @NamedQuery(name = "Estagio.findAll", query = "SELECT e FROM Estagio e"),
    @NamedQuery(name = "Estagio.findByIdEstagio", query = "SELECT e FROM Estagio e WHERE e.idEstagio = :idEstagio"),
    @NamedQuery(name = "Estagio.findByLocal", query = "SELECT e FROM Estagio e WHERE e.local = :local"),
    @NamedQuery(name = "Estagio.findByDescricao", query = "SELECT e FROM Estagio e WHERE e.descricao = :descricao"),
    @NamedQuery(name = "Estagio.findByStatus", query = "SELECT e FROM Estagio e WHERE e.status = :status")})
public class Estagio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Estagio")
    private Integer idEstagio;
    @Basic(optional = false)
    @Column(name = "local")
    private String local;
    @Basic(optional = false)
    @Column(name = "descricao")
    private String descricao;
    @Basic(optional = false)
    @Column(name = "status")
    private String status;
    @JoinTable(name = "estagio_curso", joinColumns = {
        @JoinColumn(name = "id_Estagio", referencedColumnName = "id_Estagio")}, inverseJoinColumns = {
        @JoinColumn(name = "id_Curso", referencedColumnName = "id_Curso")})
    @ManyToMany
    private List<Curso> cursoList;
    @JoinColumn(name = "email", referencedColumnName = "email")
    @ManyToOne(optional = false)
    private Login login;

    public Estagio() {
    }

    public Estagio(Integer idEstagio) {
        this.idEstagio = idEstagio;
    }

    public Estagio(Integer idEstagio, String local, String descricao, String status) {
        this.idEstagio = idEstagio;
        this.local = local;
        this.descricao = descricao;
        this.status = status;
    }

    public Integer getIdEstagio() {
        return idEstagio;
    }

    public void setIdEstagio(Integer idEstagio) {
        this.idEstagio = idEstagio;
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<Curso> getCursoList() {
        return cursoList;
    }

    public void setCursoList(List<Curso> cursoList) {
        this.cursoList = cursoList;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstagio != null ? idEstagio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estagio)) {
            return false;
        }
        Estagio other = (Estagio) object;
        if ((this.idEstagio == null && other.idEstagio != null) || (this.idEstagio != null && !this.idEstagio.equals(other.idEstagio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "admin.model.Estagio[idEstagio=" + idEstagio + "]";
    }

}
